
const base_url = "https://game.bishehoule.cn/games";
// const base_url = "https://www.askwan.cn/yx/games";
// const base_url = "http://172.16.30.238:9999/games";

const request = (obj)=>{
  const method = obj.method || "get";
  const data = obj.data || {};
  return new Promise((resolve,reject)=>{
    wx.request({
      url: base_url+obj.url,
      method:method,
      data:data,
      success(res){
        if(res.data.code === 200){
          resolve(res.data)
        }else{
          reject(res);
        }
      },
      fail(res){
        reject(res);
      }
    })
  })
}

export default request;